<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags" %><%@ taglib prefix="sap" uri="/sapien-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<s:include value="/WEB-INF/includes/css.jsp" />
	<s:include value="/WEB-INF/includes/javascript.jsp" />
	<title><s:text name="title" /></title>
</head>
<body>
	<div id="container">
		<s:include value="/WEB-INF/includes/header.jsp" />
		<div id="content">
			<div id="content-nav">
				<div class="optmenu rounded">
					<h3 class="rounded-top"><s:text name="actions" /></h3>
					<div class="optmenu-body">
						<ol>
							<li>
								<a href="<s:url action="new-discussion" namespace="/" />">
									<s:text name="new-discussion" />
								</a>
							</li>
						</ol>
					</div>
				</div>
				<s:if test="categories.size() > 0">
					<div class="optmenu rounded">
						<h3 class="rounded-top"><s:text name="categories" /></h3>
						<div class="optmenu-body">
							<ul><s:iterator value="categories">
								<li>
									<a href="<s:url action="category"><s:param name="id" value="id" /></s:url>">
										<s:property value="name"/>
									</a>
								</li>
							</s:iterator></ul>
						</div>
					</div>
				</s:if>
			</div>
			<div id="content-body">
				<h2><s:property value="discussion.subject" /></h2>
				<div class="breadcrumbs">
					<ul>
					<li class="first"><a href="<s:url action="index" namespace="/" />"><s:text name="index" /></a></li>
					<li><a href="<s:url action="category" namespace="/"><s:param name="id" value="discussion.category.id" /></s:url>">
						<s:property value="discussion.category.name" />
					</a></li>
					<li><s:property value="discussion.subject" /></li>
					</ul>
				</div>
				<s:if test="actionMessages.size() > 0">
					<div class="success rounded">
						<s:iterator value="actionMessages"><s:property /><br /></s:iterator>
					</div>
				</s:if>
				<s:if test="actionErrors.size() > 0">
					<div class="error rounded">
						<s:iterator value="actionErrors"><s:property /><br /></s:iterator>
					</div>
				</s:if>
				<s:iterator value="paginatedResult.results" status="i">
					<div id="response-<s:property value="id" />" class="box rounded response">
						<div class="response-header">
							<span class="date"><s:date name="created" nice="true"/></span>
							<span class="post-number"><a href="#">#<s:property value="((paginatedResult.page - 1) * paginatedResult.resultsPerPage) + (#i.index + 1)"/></a></span>
						</div>
						<div class="response-body">
							<div class="response-user">
								<s:if test="creator != null">
		           					<a href="<s:url action="profile"><s:param name="id" value="creator.id" /></s:url>">
		           						<s:property value="creator.username" />
		           					</a>
	           					</s:if><s:else>
	           						<s:text name="anonymous" />
	           					</s:else>
							</div>
							<div class="response-content">
								<s:property value="body" />
							</div>
						</div>
						<div class="button-bar">
							<input type="button" value="Edit" />
							<input type="button" value="Quote" />
							<input type="button" value="Test" />
						</div>
					</div>
				</s:iterator>
				<sap:pager cssClass="pager" nextLabel="Next" prevLabel="Previous" resultsPerPage="paginatedResult.resultsPerPage" page="page" total="paginatedResult.totalPages" totalResults="paginatedResult.totalResults" />
				<s:form label="%{getText('new-response.form.label')}" action="create-response" id="create_response" validate="true">
					<s:hidden name="discussionId" value="%{discussion.id}"/>
	            	<s:textarea key="body" required="true" cssClass="txt" value="" />
	            	<div class="field"><s:submit value="%{getText('new-response.form.save')}"/></div>
	            </s:form>
			</div>
			<div class="clear">&nbsp;</div>
		</div>
		<s:include value="/WEB-INF/includes/footer.jsp" />
	</div>
</body>
</html>
